<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
	 <!-- <script src="../utils/sockjs.min.js"></script> -->
		    <!-- 引入本地 StompJS 文件 -->
		    <!-- <script src="../utils/stomp.min.js"></script> -->
    <script>
      var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
        CSS.supports('top: constant(a)'))
      document.write(
        '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
        (coverSupport ? ', viewport-fit=cover' : '') + '" />')
    </script>
    <title></title>
    <!--preload-links-->
    <!--app-context-->
  </head>
  <body>
    <div id="app"><!--app-html--></div>
    <script type="module" src="/main.js"></script>
	<!--SockJS库-->
	<script src="/static/sockjs.min.js"></script>
	<!--Stomp.js 库-->
	<script src="/static/stomp.min.js"></script>
	<script>
		let socket = new SockJs("/msg/ws");
		let client = Stomp.over(socket);
		
		// 心跳配置
		client.heartbeat.outgoing = 20000; // 20秒发送一次心跳
		client.heartbeat.incoming = 0;     // 不检测服务端心跳
	
		client.connect({}, function(frame){
			console.log("链接成功");
			
			// 手动维持心跳（备用方案）
			setInterval(() => {
				socket.send(JSON.stringify({}));
			}, 15000);
		});
	</script>
  </body>
</html>
